package top.chmin.project.cloud.common.menu.auto;

// field import auto
// #bind.field.updateTime#

import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;
import top.chmin.project.cloud.common.entity.*;

/**
 * chmin
 * 2023-12-25 09:15:43
 * cloud-builder
 */
@Getter
@Setter
@Accessors(chain = true)
public class Menu extends Model {

    // field auto
// #bind.field.MenuKey#
    // key
    private String MenuKey;
// $bind.field.MenuKey$

    // #bind.field.MenuPath#
    // path
    private String MenuPath;
// $bind.field.MenuPath$

    // #bind.field.MenuLabel#
    // label
    private String MenuLabel;
// $bind.field.MenuLabel$

    // #bind.field.ParentMenu#
    // 父级菜单
    private Long ParentMenu;
// $bind.field.ParentMenu$


    @Override
    public MenuEPC getPreCondition() {
        return new MenuEPC();
    }

    public class MenuEPC extends PreCondition {
        private MenuEPC() {
        }

        private MenuEPC(MenuEPC parent) {
            super(parent);
        }

        public MenuEPC forUpdate() {
            addUpdateSql("update_time = ?", updateTime);
            addUpdateSql("update_by = ?", updateBy);
// field update auto
// #bind.field.MenuKey#
            addUpdateSql("menu_key = ?", MenuKey);
// $bind.field.MenuKey$

// #bind.field.MenuPath#
            addUpdateSql("menu_path = ?", MenuPath);
// $bind.field.MenuPath$

// #bind.field.MenuLabel#
            addUpdateSql("menu_label = ?", MenuLabel);
// $bind.field.MenuLabel$

// #bind.field.ParentMenu#
            addUpdateSql("parent_menu = ?", ParentMenu);
// $bind.field.ParentMenu$

            type = "UPDATE";
            return this;
        }

        public MenuEPC forDelete() {
            type = "DELETE";
            return this;
        }

        public MenuEPC forCount() {
            type = "COUNT";
            return this;
        }

        public MenuEPC sub() {
            return new MenuEPC(this);
        }

        public MenuEPC complete(boolean and) {
            finish(and);
            return parent == null ? this : (MenuEPC) parent;
        }

        public MenuFPC toFlex() {
            MenuFPC flex = new MenuFPC();
            flex.setUpdateSqlList(updateSqlList);
            flex.setUpdateValueList(updateValueList);
            flex.setSqlList(sqlList);
            flex.setValueList(valueList);
            flex.setType(type);
            return flex;
        }

        public Condition toCondition() {
            return toCondition(Menu.class, "");
        }

        // field epc auto
// #bind.field.id#
        public Id id() {
            return new Id();
        }

        // #bind.field.createBy#
        public CreateBy createBy() {
            return new CreateBy();
        }
// $bind.field.id$

        // #bind.field.updateBy#
        public UpdateBy updateBy() {
            return new UpdateBy();
        }

        // #bind.field.createTime#
        public CreateTime createTime() {
            return new CreateTime();
        }
// $bind.field.createBy$

        // #bind.field.updateTime#
        public UpdateTime updateTime() {
            return new UpdateTime();
        }

        // #bind.field.MenuKey#
        public MenuKey MenuKey() {
            return new MenuKey();
        }
// $bind.field.updateBy$

        // #bind.field.MenuPath#
        public MenuPath MenuPath() {
            return new MenuPath();
        }

        // #bind.field.MenuLabel#
        public MenuLabel MenuLabel() {
            return new MenuLabel();
        }
// $bind.field.createTime$

        // #bind.field.ParentMenu#
        public ParentMenu ParentMenu() {
            return new ParentMenu();
        }

        public class Id extends LongEPCField<MenuEPC> {
            private Id() {
                super(MenuEPC.this, "id", id);
            }
        }
// $bind.field.updateTime$

        public class CreateBy extends StringEPCField<MenuEPC> {
            private CreateBy() {
                super(MenuEPC.this, "create_by", createBy);
            }
        }

        public class UpdateBy extends StringEPCField<MenuEPC> {
            private UpdateBy() {
                super(MenuEPC.this, "update_by", updateBy);
            }
        }
// $bind.field.MenuKey$

        public class CreateTime extends LocalDateTimeEPCField<MenuEPC> {
            private CreateTime() {
                super(MenuEPC.this, "create_time", createTime);
            }
        }

        public class UpdateTime extends LocalDateTimeEPCField<MenuEPC> {
            private UpdateTime() {
                super(MenuEPC.this, "update_time", updateTime);
            }
        }
// $bind.field.MenuPath$

        public class MenuKey extends StringEPCField<MenuEPC> {
            private MenuKey() {
                super(MenuEPC.this, "menu_key", MenuKey);
            }
        }

        public class MenuPath extends StringEPCField<MenuEPC> {
            private MenuPath() {
                super(MenuEPC.this, "menu_path", MenuPath);
            }
        }
// $bind.field.MenuLabel$

        public class MenuLabel extends StringEPCField<MenuEPC> {
            private MenuLabel() {
                super(MenuEPC.this, "menu_label", MenuLabel);
            }
        }

        public class ParentMenu extends LongEPCField<MenuEPC> {
            private ParentMenu() {
                super(MenuEPC.this, "parent_menu", ParentMenu);
            }
        }
// $bind.field.ParentMenu$

    }
}
